public class File extends SystemItem {

	private String contents;

	// Initialize a file object with a name, parent directory,
	// and set its contents to an empty string.
	public File(String n, Directory dir) {
		super(n, dir);
		contents = "";
	}

	// Get and Set methods for contents.
	public String getContents() {
		return contents;
	}

	public void setContents(String text) {
		contents = text;
	}

	// Reset contents to an empty string.
	public void eraseContents() {
		this.setContents("");
	}

	// POTENTIAL ERROR: watch out for how appends works.
	// check on unix/linux/osx for the cAse when you append
	// string to an empty file. Should it create a newline or not?

	// Append text to contents after adding a new line.
	public void appendContents(String text) {
		contents = contents + "\n" + text;
	}

	// Print contents to the screen.
	public void printContents() {
		System.out.println(getContents());
	}
}